package kaiao.dynamic;

public class 最长连续子串 {

	public static void main(String[] args) {

	}

	public int getSum(int[] nums) {

		/*
		1.定义状态转移公式
		dp[i] = if d[i] < max d[i - 1] else d[i - 1] + 1
		2.初始化
		d[0] = 0;
		 */
		int n = nums.length;
		int[] dp = new int[n + 1];
		dp[0] = 0;

		int maxNums = 0;

		for (int i = 1; i < n + 1; i++) {

			if (nums[i] > maxNums && maxNums != nums[i]) {
				dp[i] = dp[i - 1] + 1;
				maxNums = nums[i];
			} else {
				dp[i] = dp[i-1];
			}
		}

		return dp[n];
	}
}
